﻿using System;
using System.Linq;
using System.Web.Http;
using Medora.Model.Institutions;
using Medora.Services;
using Medora.Services.Institutions;

namespace MvcApp.Controllers
{
    [RoutePrefix("api/Providers")]
    public class ProvidersController : ControllerBase<Provider, ProviderFilter>
    {
        private readonly IProvidersService _service;

        public ProvidersController(IProvidersService service)
            : base(service)
        {
            _service = service;
        }

        [Route("GetByDepartment")]
        public IHttpActionResult GetByDepartment(Guid id)
        {
            return Ok(_service.Get(new ProviderFilter { DepartmentId = id }));
        }

        [Route("GetByDepartmentLazy")]
        public IHttpActionResult GetByDepartmentLazy(Guid id)
        {
            return Ok(_service.GetByDepartmentLazy( id ).ToList());
        }
    }
}